﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using testing_thing;


namespace Swinemon_Form
{
    public partial class MainForm : Form
    {
        private Player p;
        private CommandProcessor cp;
        private string input;

        public MainForm()
        {
            InitializeComponent();
            IWorldLoader loader = new FileWorldLoader();
            Location start = loader.Load();
            p = new Player(new string[] { "awesome" });
            p.InLocation = start;

            cp = new CommandProcessor();
            richTextBox1.Text="Hi, welcome to Swinemon(GUI-console).\n";
        }

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void Doit_Click(object sender, EventArgs e)
        {
            input = textBox1.Text;
            richTextBox1.AppendText("\nInput: \n" + input + "\n\nOutput: \n" + cp.Run(p, input) + "\n");
            textBox1.Text = "";

        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                input = textBox1.Text;
                richTextBox1.AppendText("\nInput: \n"+ input+ "\n\nOutput: \n" + cp.Run(p, input) + "\n");
                textBox1.Text = "";
            }


        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
 


    }
}
